<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!DOCTYPE html>
<html lang="en" >
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta name="keywords" content="kline time-line candlestick stock chart canvas k线 行情 蜡烛图 分时图 技术指标 图表"/>
    <meta name="description" content="shape test"/>
    <script type="text/javascript" src="../dist/klinecharts.min.js"></script>
    <script type="text/javascript" src="./js/dataSource.js"></script>
    <link rel="stylesheet" type="text/css" href="./css/chart.css"/>
    <title>技术指标覆盖</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="chart"></div>
    <script>
      window.onload = function () {
        var chart = klinecharts.init('chart')
        // 创建的时候直接修改
        chart.createTechnicalIndicator({ 
          name: 'MA',
          precision: 3,
          calcParams: [5, 10],
          styles: { line: { size: 2, colors: ['#00ff00', '#ff00ff'] } }
        }, false, { id: 'candle_pane' })
        
        // 创建两个相同的EMA副图指标
        chart.createTechnicalIndicator('EMA')
        chart.createTechnicalIndicator('EMA')
        // 修改所有创建好的EMA指标
        chart.overrideTechnicalIndicator({
          name: 'EMA',
          precision: 3,
          calcParams: [20],
          styles: { line: { size: 2, colors: ['#09cf00', '#ff00ff'] } }
        })

        // 创建两个相同的BOLL副图指标
        var bollPaneId = chart.createTechnicalIndicator('BOLL')
        chart.createTechnicalIndicator('BOLL')
        // 修改指定窗口上创建好的BOLL指标
        chart.overrideTechnicalIndicator({
          name: 'BOLL',
          precision: 3,
          calcParams: [16, 5],
          styles: { line: { size: 2, colors: ['#AC89BB', '#78bcaa', '#00ffad'] } }
        }, bollPaneId)
        chart.applyNewData(generated())
      }
    </script>
  </body>
</html>
